package com.psa.element;

import com.google.gson.Gson;
import com.psa.tool.SystemStatus;

/**
 * Created by david on 14-3-27.
 */
public class RequestCmd implements IJson {
    public String UID = "";
    public String UserID = "";
    public String Corp = "";
    public String SalesmanID = "";
    public String Type ="";
    public String Param = "";
    public String Result = "";
    public String Version = "";

    @Override
    public String toJson() {
        return new Gson().toJson(this);
    }

    public static RequestCmd create(String uid, String userid, String corp, String type, String param, String result){
        RequestCmd cmd = new RequestCmd();
        cmd.UID = uid;
        cmd.UserID = userid;
        cmd.Corp = corp;
        cmd.SalesmanID = SystemStatus.currentUser.getSalesmanID();
        cmd.Type = type;
        cmd.Param = param;
        cmd.Result = result;
        cmd.Version = "";
        return cmd;
    }

    public static RequestCmd create(String uid, String type, String param, String result){
        return create(uid, SystemStatus.currentUser.getId(), SystemStatus.currentUser.getCorp(), type, param, result);
    }

    public static RequestCmd create(String type, String param, String result){
        return create(SystemStatus.currentUser.getUID(), type, param, result);
    }

    public static RequestCmd create(String type, String param){
        return create(type, param, "");
    }
}
